//
//  HLTabBarViewController.m
//  Various
//
//  Created by HarwordLiu on 16/3/23.
//  Copyright © 2016年 Harword. All rights reserved.
//

#import "HLTabBarViewController.h"

#import "FXCPianoViewController.h"

#import "PZLViewController.h"

#import "HLYiYanViewController.h"

#import "HLMyEyesViewController.h"


@interface HLTabBarViewController ()

@end

@implementation HLTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];


    FXCPianoViewController *piano = [[FXCPianoViewController alloc] init];
    
    [self addChild:piano  image:@"mei" imageSele:@"mei" title:@"美"];

    
    PZLViewController *pzlViewVC = [PZLViewController new];
    [self addChild:pzlViewVC image:@"iconfont-icontuozhuaizuoyou" imageSele:@"iconfont-icontuozhuaizuoyou-2" title:@"贱  傻"];
    
    HLYiYanViewController *yiyanVC = [[HLYiYanViewController alloc] init];
    [self addChild:yiyanVC image:@"YiYanTabBar" imageSele:@"YiYanTabBar" title:@"一言"];
    
    HLMyEyesViewController *myEyesVC = [[HLMyEyesViewController alloc] init];
    [self addChild:myEyesVC image:@"myEyes" imageSele:@"myEyes" title:@"眼"];

}

- (void)addChild:(UIViewController *)childVC
           image:(NSString *)image
       imageSele:(NSString *)imageSele
           title:(NSString *)title{
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVC];
    childVC.tabBarItem.title = title;
    childVC.tabBarItem.image =
    [UIImage imageNamed:image];
    childVC.tabBarItem.selectedImage =
    [[UIImage imageNamed:imageSele] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    // 取消tabbar文字渲染效果,属性字符串
    NSMutableDictionary *dicTemp = [NSMutableDictionary dictionary];
    dicTemp[NSForegroundColorAttributeName] = [UIColor grayColor];
    
    NSMutableDictionary *dicTempTwo = [NSMutableDictionary dictionary];
    dicTempTwo[NSForegroundColorAttributeName] = [UIColor blackColor];
    
    [childVC.tabBarItem
     setTitleTextAttributes:dicTemp forState:UIControlStateNormal];
    [childVC.tabBarItem setTitleTextAttributes:dicTempTwo forState:
     UIControlStateSelected];
    
    [self addChildViewController:nav];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
